const Router = require('koa-router');
const jwt = require('koa-jwt')
const {
  secret
} = require('../config');
const router = new Router({
  prefix: '/products'
});
const {
  find,
  findById,
  findProductsByUser,
  create
} = require('../controllers/products');

const auth = jwt({
  secret
});

router.get('/', auth, find);
router.post('/', auth, create);
router.get('/:id', auth, findById);
router.get('/findProductsByUser/:id', auth, findProductsByUser);
 
 
module.exports = router;
